package com.zmn.plat.admin.controller.base.homepage;

import com.zmn.base.common.data.common.dio.recentlyuse.RecentlyUsedMenuDIO;
import com.zmn.base.common.data.dubbo.interfaces.recentlyuse.RecentlyUseRemoteService;
import com.zmn.base.plat.engine.common.util.response.DubboResponseUtils;
import com.zmn.common.dto2.ResponseDTO;
import com.zmn.plat.admin.controller.PlatBaseController;
import com.zmn.plat.dubbo.utils.DubboConsts;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 描述: 首页接口
 *
 * @author fengxuecai
 * @since 2022/6/17 13:45
 */
@Slf4j
@RestController
@RequestMapping("/base/homePage")
@Api(tags = "首页接口")
public class HomePageController extends PlatBaseController {

    @DubboReference(version = DubboConsts.INTERFACE_VERSION, check = false)
    private RecentlyUseRemoteService recentlyUseRemoteService;

    /**
     * 描述: 首页-最近使用添加
     *
     * @author fengxuecai
     * @since 2022/6/24 16:21
     */
    @ApiOperation("首页-最近使用添加")
    @PostMapping("/recentlyUsedMenu/add")
    public ResponseDTO<Integer> addMenuRecentlyUsed(@RequestBody RecentlyUsedMenuDIO recentlyUsedMenuDio) {

        return ResponseDTO.success(DubboResponseUtils.resultToThrow(() -> recentlyUseRemoteService.addRecentlyUse(recentlyUsedMenuDio, getMcStaffId())));
    }

}
